package com.road.vast.springboot;

import com.road.vast.springboot.pojo.Holiday;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.TaskService;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author 郭泽鹏
 * @Date 2020/6/23 10:25
 * @Version 1.0
 * 对查询出来的 用户任务信息（ActivitiTaskQuery） 进行处理
 * 影响表：
 * act_hi_taskinst：任务实例
 */
public class ActivitiTaskProcess {
    public static void main(String[] args) {
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        TaskService taskService = processEngine.getTaskService();
        //对查询出来的任务进行处理，2505
        String taskId = "162502";

        //在 填写请假单时 设置请假天数
//        Map<String, Object> map = new HashMap<>();
//        Holiday holiday = new Holiday();
//        holiday.setNum(5F);
//        holiday.setAssignee0("aa");
//        holiday.setAssignee1("bb");
//        holiday.setAssignee2("cc");
//        holiday.setAssignee3("dd");
//        map.put("holiday", holiday);

        //测试包含网关
        Map<String, Object> map = new HashMap<>();
        Integer userType = 1;
        map.put("userType", userType);
        if (taskId != null){
            //参数：任务id
//            taskService.complete(taskId);
            taskService.complete(taskId, map);
            System.out.println("完成任务：" + taskId);
        }else{
            System.out.println("没有对应的任务");
        }

    }
}
